

  <table width="100%" style="vertical-align:middle;" border="1" cellspacing="0" cellpadding="0" rules="all" id="tbl_itm_sp" class="tableIn">
      <thead>
        <tr>
          <th>Item</th>
          <th>Almac&eacute;n</th>
          <th>Articulo</th>
          <th>Descripcion</th>
          <th>Precio por UM</th>
          <th>Ctd.UM</th>
          <th>UM</th>
          <th>Ctd.Final</th>
          <th>Dcto(%)</th>
          <th>Bruto</th>
          <th>Sts</th>
          <th>&nbsp;</th>
        </tr>
        </thead>
        <tbody>
         <?php 		 
		 $last = '';
		 if (!$find){
				$itm_cnt = 0;
				$disable= '';
					 for($a=0;$a<11;$a++){
						$itm_cnt = $itm_cnt + 1;
			$sp_posn[] = '';
			//$oc_dcto[] = $row['DetOrdDct'];
			$sp_cods[] = '';
			$sp_noms[] = '';
			$sp_prun[] = '';
			$sp_qtpe[] = '';
			$sp_qtat[] = '';
			$sp_qtfi[] = '';
			$sp_unm[] = '';
			$sp_nets[] = '';
			$sp_brut[] = '';
			$sp_almc[] = '';
			//$oc_cent[] = $row['CentroID'];
			$sp_dels[] = '';
					 }		 		 
		 }
		 else {
		 $itm_cnt = $itm_cnt + 1;
		 }
//		 echo $itm_cnt;
		 for($a=0;$a < $itm_cnt ; $a++){
		 $hide = '';
		 $disable = '';
		 $mult = 1;
		 
			 if ($a == ($itm_cnt-1)){
			 // La Ultima Linea
				$hide = 'display:none';
				$sp_posn[] = '';
			//$oc_dcto[] = $row['DetOrdDct'];
			$sp_cods[] = '';
			$sp_noms[] = '';
			$sp_prun[] = '';
			$sp_qtpe[] = '';
			$sp_qtat[] = '';
			$sp_qtfi[] = '';
			$sp_unm[] = '';
			$sp_nets[] = '';
			$sp_brut[] = '';
			$sp_almc[] = '';
				$last = 'trLast';
				$sp_dels[] =  '';
			 }
			 else {
				 if ($sp_qtat[$a]>0){		
				 $disable = 'disabled';
				 $mult = -1;
				}
			 }
		 ?>         
        <tr style="<?php echo $hide;?>" title="<?php echo $sp_posn[$a];?>" class="<?php echo $last;?>" onkeypress="introTr_SP(event)">
          <td><a href="#d_sp_his" onclick="verHistSP(this)"><?php echo $sp_posn[$a];?></a></td>
          <td><select class="clsSPAlm <?php echo $disable;?>">
              <?php echo str_replace("value='".$sp_almc[$a]."'","value='".$sp_almc[$a]."' selected='selected'",$combo_alm);   ?>
          </select></td>
          <td><input type="text" class="clsCodSp <?php echo $disable;?>" value="<?php echo $sp_cods[$a]; ?>" title="<?php echo $sp_cods[$a]; ?>"  <?php echo $disable;?>></td>
          <td><span class="clsTxtSp"><?php echo $sp_noms[$a]; ?></span></td>
          <td class="clsOCPre">
          <input  type="text" class="qt clsPreUM <?php echo $disable;?>" onchange="mr(this);" size="15" value="<?php echo $sp_prun[$a]; ?>" maxlength="10" <?php echo $disable;?> /> </td>
          <td><input  type="text" class="qt clsQtySp <?php echo $disable;?>" onchange="mr(this); calcUM_SP(this);"  value="<?php echo $sp_qtpe[$a]; ?>" size="10" maxlength="8" <?php echo $disable;?> > </td>
          <td><select class="clsQtyUM" onchange="calcUM_SP(this)">
          <?php echo str_replace("value='".$sp_unm[$a]."'","value='".$sp_unm[$a]."' selected='selected'",$combo_um);   ?>
          </select></td>
          <td class="qt clsCtdFin"><?php echo $sp_qtfi[$a]; ?></td>
          <td><input class="qt clsDctOc <?php echo $disable;?>" type="text" onchange="mr(this);" value="<?php echo /*$oc_dcto[$a];*/ '0'; ?>" name="t_sp_dct" id="t_sp_dct" /></td>
          <td class="qt clsBruSp"><?php echo $sp_brut[$a]; ?></td>
          <td><select class="clsSpSts"><option value=" ">OK</select></td>
          <td><input type="button" title="Quitar Item" value="X" <?php if ($disable=='') echo 'onclick="delPos_SP(this)"'; ?> /></td>
        </tr>
        <?php 
		}
		?>
        </tbody>
        <tfoot>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td><input name="btn_addnew" type="button" value="Agregar" onclick="addPosSP()" /></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
       </tfoot>
      </table>
